<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of video
 *
 * @author b4by
 */
class video extends MY_Controller{
	function __construct() {
		parent::__construct();
		$this->load->model('model_image');
	}
	
	public function index(){
		$this->data['module_name'] = lang('video_manage');
		$this->data['module_desc'] = lang('video_manage_desc');
		$this->data['module'] = 'video';
		$this->data['temp'] = 'admin/image/index';
		$this->load->view('admin/main',$this->data);
	}
	
	public function read()
	{
		
		$pagination = pagination_init($this->model_image->get_total(array('video'	=> 1)), request('p',1));
		
		$images = $this->model_image->get_list(array(
			'where'	=> array('video'	=> 1),
			'limit'=>array($pagination->from,$pagination->limit)
		));
		foreach($images as &$image)
		{
			$image->thumb2=image_url($image->thumb2);
			$image->link = url_create('site','photo','index',$image->id);
		}
		
		echo json_encode(array(
			'state'	=> 'success',
			'data'	=> $images,
			'pagination'	=> $pagination,
		));
	}
	
}

?>
